<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Prac</title>
</head>
<body>
    <h1 id="hh1">我是</h1>
</body>
<script>
    //DOM 文档对象模型
    var a = 'a';
    alert(typeof document.getElementById('hh1'));
</script>
<script>
/*     var com1 = '65a';
    
    var com2 = 'a';
    var com3 = "a30";

    document.write(com1==com2);
    
    document.write(com1==com3); */

    //Array类
/*     var arr = new Array(1,2,3,4);
    arr[10] = 50
    alert(arr[10]);//50
    alert(arr[9]);//undefined
    alert(arr[3]);//4

    var brr = new Array(1,"A",true,12.34);
    console.log(brr);//1,"A",true,12.34

    var crr = new Array();
    console.log(crr);

    var drr = [1,2,3,4,5];
    drr.push(6,7);
    
    drr.splice(4,2);
    drr.forEach(function add(e){
        console.log(e);
    }) */
    // String类
/*     var str = "Elysian ";
    console.log(str);//"Elysian "
    console.log(str.length);//8
    console.log(str.charAt(4));//i
    console.log(str.indexOf("si"));//3
    console.log(str.trim());//"Elysian"
    console.log(str.substring(3));//sian
    console.log(str.substring(0,3));//Ely */

    //自定义对象
/*     var user = {
        name:"张三",
        age:23,
        eat: function(){
            console.log("吃饭");
        },
      	drink(){
        	console.log("喝水");
      	}
    };
    
    console.log(user.name);//张三
    console.log(user.age);//23
    user.eat();//吃饭
	user.drink()//喝水

    console.log(user.name);//张三
    console.log(user.age);//23
    user.eat();//吃饭
    user.drink();//喝水 */
    //JSON
/*     var jsonStr = '{"name":"Tom","age":23,"address":["北","上","广","深"]}';
    console.log(jsonStr);//'{"name":"Tom","age":23,"address":["北","上","广","深"]}'
    var jsonObj = JSON.parse(jsonStr);
    console.log(jsonObj.address[0]);//北

    jsonSTR = JSON.stringify(jsonObj);
    console.log(jsonSTR);//'{"name":"Tom","age":23,"address":["北","上","广","深"]}' */


</script>
<script>
    //BOM---浏览器对象模型
/*     //1.window对象
    var re1 = window.alert("你好");
    console.log(re1);//undefined 无返回值
    // 定义1
    //这种方式不知道为什么，会直接执行，而不是等待8s后执行
    function eat(e){
        alert(e + "JS");
    }
    window.setTimeout(eat(2),8000);//2JS
    //定义2
    var re2 = setTimeout(function eat(e){
        alert(e+"JS");//undefinedJS
    },2000);
    console.log(re2);
    var re3 = setInterval(eat(4),2000);
    console.log(re3);

    //2.Location对象
    //获取浏览器地址栏信息
    alert(location.href);
    //设置浏览器地址栏信息
    //location.href = "https://www.itcast.cn"; */

    
</script>
</html>